<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/1/10
 * Time: 2:04
 */

namespace app\common\model;


use think\Model;
use think\Db;
class Settings extends Model
{


    public function updateSettings($data = [])
    {
        $is_break = true;
        foreach ($data as $item => $value) {
            try {
               Db::name('settings')->where(['name'=>$item])->update(['value'=> $value]);

            } catch (Exception $e) {
                $is_break = false;
                break;
            }
        }

        if (!$is_break) {
            return false;
        }
        return true;
    }
}